package com.example.week11_service;

import android.content.Intent;
import android.os.Binder;
import android.os.IBinder;
import android.util.Log;

/**
 * Created by Administrator on 2022/5/16.
 */

public class MyBinder extends Binder {

    public MyService getService()
    {
        return MyService.this;
    }

        private MyBinder myBinder = new MyBinder();
        private String valueToShow = "我代表希望传出去的值";

        public String getValue() {
            return valueToShow;
        }


        public IBinder onBind(Intent intent) {
            String msg = intent.getStringExtra("message");
            Log.d("MyService", "绑定时收到MainActivity intent信息:" + msg);
            return myBinder;
        }



        public boolean onUnbind(Intent intent) {
            Log.d("MyService", "散伙就散伙---onUnbind executed!");
            return super.onUnbind(intent);
        }

        public String dosomeOperation(String str) {
            Log.d("MyService", "收到MainActivity要求:" + str);
            return "谁怕谁，跟一个！";
        }
    }
